Learn Kubernetes - from the beginning, Part I, Basics, Deployment and Minikube
Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris
Kubernetes is about orchestrating containerized apps. Docker is great for your first few containers. As soon as you need to run on multiple machines and need to scale/up down and distribute the load and so on, you need an orchestrator - you need Kubernetes
This is the first part of a series of articles on Kubernetes, cause this topic is BIG!.
- Part I - from the beginning, Part I, Basics, Deployment and Minikube we are here
- Part II introducing Services and Labeling In this part, we deepen our knowledge of Pods and Nodes. We also introduce Services and labeling using labels to query our artifacts.
- Part III Scaling Here we cover how to scale our app
- Part IV - Auto scaling In this part we look at how to set up auto-scaling so we can handle sudden large increases of incoming requests
In this part I hope to cover the following:
- Why Kubernetes and Orchestration in General
- Hello world: Minikube basics, talking through Minikube, simple deploy example
- Cluster and basic commands, Nodes,
- Deployments, what it is and deploying an app
- Pods and Nodes, explain concepts and troubleshooting
Why Orchestration
Well, it all started with containers. Containers gave us the ability to create repeatable environments so dev, staging, and prod all looked and functioned the same way. We got predictability and they were also light-weight as they drew resources from the host operating system. Such a great breakthrough for Developers and Ops but the Container API is really only good for managing a few containers at a time. Larger systems might consist of 100s or 1000+ containers and needs to be managed as well so we can do things like scheduling, load balancing, distribution and more.
At this point, we need orchestration the ability for a system to handle all these container instances. This is where Kubernetes comes in.
Resources
- Kubernetes.io One of the best resources to learn about Kubernetes is at this official Kubernetes site by Google.
- Kubernetes overview An overview on Kubernetes, all its parts and how it works
- Free Azure Account If you want to try out AKS, Azure Kubernetes Service, you will need a free Azure account
- Kubernetes in the Cloud Do you feel you know everything about Kubernetes already and just want to learn how to use a managed service? Then this link is for you
- Documentation on AKS, Azure Kubernetes Service Azure Kubernetes Service, a managed Kubernetes
- Best practices on AKS You already know AKS and want to learn how to use it better?
Kubernetes
So what do we know about Kubernetes?
It's an open-source system for automating deployment, scaling, and management of containerized applications
Let'start with the name. It's Greek for Helmsman, the person who steers the ship. Which is why the logo looks like this, a steering wheel on a boat:
It's Also called K8s so K ubernete s, 8 characters in the middle are removed. Now you can impress your friends that you know why it's referred to as K8.
Here is some more Jeopardy knowledge on its origin. Kubernetes was born out of systems called Borg and Omega. It was donated to CNCF, Cloud Native Computing Foundation in 2014. It's written in Go/Golang.
If we see past all this trivia knowledge, it was built by Google as a response to their own experience handling a ton of containers. It's also Open Source and battle-tested to handle really large systems, like planet-scale large systems.
So the sales pitch is:
Run billions of containers a week, Kubernetes can scale without increasing your ops team
Sounds amazing right, billions of containers cause we are all Google size. No? 😃 Well even if you have something like 10-100 containers, it's for you.
## Getting started
Ok ok, let's say I buy into all of this, how do I get started?
Impatient ey, sure let's start to do something practical with Minikube
Ok, sounds good I'm a coder, I like practical stuff. What is Minikube?
Minikube is a tool that lets us run Kubernetes locally
Oh, sweet, millions of containers on my little machine?
Well, no, let's start with a few and learn Kubernetes basics while at it.
Installation
To install Minikube lets go to this installation page
It's just a few short steps that means we install
- a Hypervisor
- Kubectl (Kube control tool)
- Minikube
Run
Get that thing up and running by typing:
minikube start
It should look something like this:
You can also ensure that kubectl have been correctly installed and running:
kubectl version
Should give you something like this in response:
Ok, now we are ready to learn Kubernetes.
Learning kubectl and basic concepts
In learning Kubernetes lets do so by learning more about kubectl a command line program that lets us interact with our Cluster and lets us deploy and manage applications on said Cluster.
The word Cluster just means a group of similar things but in the context of Kubernetes, it means a Master and multiple worker machines called Nodes. Nodes were historically called Minions